/**
 * 
 */
package aiproject3.agents;

import aiproject3.models.KnowledgeBase;
import aiproject3.predictors.Predictor;

/**
 * Base class for a limited learning Agent
 * @author Chris Smith
 */
public class Agent<U, E> {

	protected KnowledgeBase<U, E> _data;
	
	protected Predictor<U> _predictor;
	
	public Agent(KnowledgeBase<U, E> data, Predictor<U> predictor) {
		this._data = data;
		this._predictor = predictor;
	}
	
	public KnowledgeBase<U, E> getData() {
		return _data;
	}
	
	/**
	 * Adds a language unit to the model
	 * @param unit The language unit to add to the model
	 */
	public void addToModel(U unit) {
		_data.addToModel(unit);
		_predictor.updatePredictor(unit);
	}
	
	/**
	 * Predicts the next unit based on the current model
	 * @return
	 */
	public U predictNext() {
		return _predictor.predictNext();
	}
	
}
